
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../page/component/theme/custom_size.dart';

///普通text
// ignore: non_constant_identifier_names
Widget MyText(String content, double fontSize, Color color) {
  return Text(content, style: TextStyle(fontSize: fontSize, color: color));
}

///可以调节粗细的text
Widget MyTextWeight(
    String content, double fontSize, Color color, FontWeight fontWeight) {
  return Text(content,
      style:
          TextStyle(fontSize: fontSize, color: color, fontWeight: fontWeight));
}

///可以调节粗细的单行text 过长显示省略号
Widget MyTextSingle(
    String content, double fontSize, Color color, FontWeight fontWeight, {TextAlign? textAlign, int maxLines = 1}) {
  return Text(content,
      overflow: TextOverflow.ellipsis,
      maxLines: maxLines,
      textAlign: textAlign,
      style:
          TextStyle(fontSize: fontSize, color: color, fontWeight: fontWeight));
}

///可以调节粗细的单行text 过长显示省略号
Widget MyTextSingleScale(
    String content, double fontSize, Color color, FontWeight fontWeight) {
  return Text(content,
      overflow: TextOverflow.ellipsis,
      textScaleFactor: 1,
      maxLines: 1,
      style:
      TextStyle(fontSize: fontSize, color: color, fontWeight: fontWeight));
}

///图片
Widget imgWidget(double width, double height, String assetName) {
  return SizedBox(
      width: width, height: height, child: Image.asset("images/$assetName.png", fit: BoxFit.contain));
}


///空列表背景
Widget NullListWidget(String img, String content) {
  return Container(
    margin: EdgeInsets.only(top: ScreenUtil().setHeight(80)),
    child: Column(
      mainAxisAlignment:MainAxisAlignment.center,
      children: <Widget>[
        Container(
          child: Image(
            width: 120,
            height: 120,
            image: AssetImage(img),
          ),
        ),
      MyText(content, CustomSize.appBarTitleSize, const Color(0xff999999))
      ],
    ),
  );
}

///阴影
Decoration shade() {
  return BoxDecoration(
      color: Colors.white,
      borderRadius: BorderRadius.circular(6.0),
      boxShadow: const [
        BoxShadow(
          offset: Offset(0, 4),
          blurRadius: 4, //阴影范围
          spreadRadius: 0, //阴影浓度
          color: Color.fromRGBO(2, 136, 255, 0.4), //阴影颜色
        ),
      ]);
}

///背景
Decoration backdrop(Color color, double radius) {
  return BoxDecoration(
      color: color, borderRadius: BorderRadius.all(Radius.circular(radius)));
}


